Interrupt, InterruptX Routines ---------------------------------------------------------------------------- Action Allow BASIC programs to perform DOS system calls. Syntax CALL Interrupt ( interruptnum%, inregs, outregs) CALL InterruptX ( interruptnum%, inregs, outregs) Remarks The Interrupt routines use the following arguments. ----------------------------------------------------------------------------- Argument Description ---------------------------------------------------------------------------- interruptnum% A DOS interrupt number that is an integer between 0 and 255. inregs The register values before the interrupt is performed; inregs is declared as type RegType or RegTypeX. The user-defined types RegType and RegTypeX are described below. outregs The register values after the interrupt is performed; outregs Argument Description ---------------------------------------------------------------------------- interrupt is performed; outregs is declared as type RegType or RegTypeX. The user-defined types RegType and RegTypeX are described below. The following statement defines RegTypeX. TYPE RegTypeX AX AS INTEGER BX AS INTEGER CX AS INTEGER DX AS INTEGER BP AS INTEGER SI AS INTEGER DI AS INTEGER FLAGS AS INTEGER DS AS INTEGER ES AS INTEGER END TYPE The following statement defines RegType (the DS and ES registers are not included). TYPE RegType AX AS INTEGER BX AS INTEGER CX AS INTEGER DX AS INTEGER BP AS INTEGER SI AS INTEGER DI AS INTEGER FLAGS AS INTEGER END TYPE Each element of the type corresponds to a CPU element. InterruptX uses the values in the DS and ES registers. To use the current values of these registers, set the record elements to -1. The Interrupt and InterruptX routines replace the INT86 and INT86X routines used in earlier versions of BASIC. They provide a more convenient way for BASIC programs to use DOS interrupts and services. To use Interrupt or InterruptX in the QBX environment, use the QBX.QLB Quick library. To use Interrupt or InterruptX outside of the QBX environment, link your program with the QBX.LIB file. The QBX.BI header file contains the necessary declarations for Interrupt and InterruptX . Note The Interrupt and InterruptX routines are not available in OS-2 protected mode. For OS-2 protected mode, replace Interrupt with the equivalent OS-2 function invocations. For more information about doing OS-2 calls from BASIC, see Chapter 14, "OS-2 Programming" in the Programmer's Guide. Example The following example uses Interrupt to determine the current drive and the amount of free space remaining on the drive. To use Interrupt, you must load the Quick library QBX.QLB using the -L option when you begin QBX. You also must include the QBX.BI header file as shown below. ' $INCLUDE. 'QBX.BI' DIM regs AS RegType' Define registers. ' Get current drive info. regs.ax = &H1900 CALL Interrupt(&H21, regs, regs) ' Convert drive info to readable form. Drive$ = CHR$((regs.ax AND &HFF) + 65) + "." ' Get disk's free space. regs.ax = &H3600 regs.dx = ASC(UCASE$(Drive$)) - 64 CALL Interrupt(&H21, regs, regs) ' Decipher the results. SectorsInCluster = regs.ax BytesInSector = regs.cx IF regs.dx >= 0 THEN ClustersInDrive = regs.dx ELSE ClustersInDrive = regs.dx + 65536 END IF IF regs.bx >= 0 THEN ClustersAvailable = regs.bx ELSE ClustersAvailable = regx.bx + 65536 END IF Freespace = ClustersAvailable * SectorsInCluster * BytesInSector ' Report results. CLS PRINT "Drive "; Drive$; " has a total of"; PRINT USING "###,###,###"; Freespace; PRINT " bytes remaining free."